<?php

/**
 * typeformulaire form base class.
 *
 * @method typeformulaire getObject() Returns the current form's model object
 *
 * @package    forumCDE
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasetypeformulaireForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'code'             => new sfWidgetFormInputText(),
      'description'      => new sfWidgetFormInputText(),
      'parent_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('parent'), 'add_empty' => true)),
      'workflow_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('workflow'), 'add_empty' => true)),
      'service_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('service'), 'add_empty' => false)),
      'showdemandelibre' => new sfWidgetFormInputCheckbox(),
      'joursclotureauto' => new sfWidgetFormInputText(),
      'conserverfiles'   => new sfWidgetFormInputCheckbox(),
      'activeStatus'     => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'code'             => new sfValidatorString(array('max_length' => 15)),
      'description'      => new sfValidatorString(array('max_length' => 255)),
      'parent_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('parent'), 'required' => false)),
      'workflow_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('workflow'), 'required' => false)),
      'service_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('service'))),
      'showdemandelibre' => new sfValidatorBoolean(array('required' => false)),
      'joursclotureauto' => new sfValidatorInteger(array('required' => false)),
      'conserverfiles'   => new sfValidatorBoolean(array('required' => false)),
      'activeStatus'     => new sfValidatorInteger(),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('typeformulaire[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'typeformulaire';
  }

}
